package cn.fxzhang.leetcode.utils;

/**
 * @author 张晓帆
 * @date 2021/3/30
 */
public class FileNameUtil {

    public static String midLineToUnderLine(String fileName){
        String name = "_" + fileName.replace("-", "_");
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < name.length(); i++){
            char pre = name.charAt(i - 1);
            if (pre == '_'){
                // 小写转大写
                sb.append((char)(name.charAt(i)-32));
            } else {
                sb.append(name.charAt(i));
            }

        }
        return sb.toString();
    }
}
